//-----------------------------------------------------------
//
//-----------------------------------------------------------
class LightsaberFireW extends KFMeleeFire;

var() array<name> FireAnims;

simulated event ModeDoFire()
{
	local int AnimToPlay;
	
	//if(Lightsaber(weapon).bIsThrown) //Can't attack if its thrown
	//    return;
	if(FireAnims.length > 0)
	{
		AnimToPlay = rand(FireAnims.length);
		FireAnim = FireAnims[AnimToPlay];
	}

	Super.ModeDoFire();
}

simulated function Timer()
{
	local Actor HitActor;
	local vector StartTrace, EndTrace, HitLocation, HitNormal;
	local rotator PointRot;
	local Disintegrate2Proj p;

	if( !KFWeapon(Weapon).bNoHit )
	{
		StartTrace = Instigator.Location + Instigator.EyePosition();

		if( Instigator.Controller!=None && PlayerController(Instigator.Controller)==none && 
			Instigator.Controller.Enemy!=None )
		{
			PointRot = rotator(Instigator.Controller.Enemy.Location-StartTrace); // Give aimbot for bots.
		}
		else
		{
			PointRot = Instigator.GetViewRotation();
		}

		EndTrace = StartTrace + vector(PointRot)*weaponRange;
		HitActor = Instigator.Trace( HitLocation, HitNormal, EndTrace, StartTrace, true);

		if (HitActor!=None)
		{
			ImpactShakeView();

			if( HitActor.IsA('ExtendedZCollision') && HitActor.Base != none &&
				HitActor.Base.IsA('KFMonster') )
			{
				HitActor = HitActor.Base;
			}

			if( Level.NetMode==NM_Client )
			{
				Return;
			}

			if( (KFMonster(HitActor)!=none) )
			{
				p = Spawn(Class'PerksSimHostOrg.Disintegrate2Proj', instigator,, HitLocation, PointRot);
				if(MeleeHitSounds.Length > 0)
				{
					Weapon.PlaySound(MeleeHitSounds[Rand(MeleeHitSounds.length)],SLOT_None,MeleeHitVolume,,,,false);
				}
			}
		}
	}
}

defaultproperties
{
     FireAnims(0)="Fire"
     FireAnims(1)="Fire2"
     FireAnims(2)="fire3"
     FireAnims(3)="Fire4"
     FireAnims(4)="Fire5"
     FireAnims(5)="Fire6"
     MeleeDamage=7550
     ProxySize=0.150000
     weaponRange=120.000000
     DamagedelayMin=0.320000
     DamagedelayMax=0.320000
     hitDamageClass=Class'PerksSimHostOrg.DamTypeLightsaber'
     MeleeHitSounds(0)=Sound'Lightsaber_SN.Weapon_Lightsaber.LSwall011'
     MeleeHitSounds(1)=Sound'Lightsaber_SN.Weapon_Lightsaber.LSwall021'
     MeleeHitVolume=2.000000
     HitEffectClass=Class'PerksSimHostOrg.LightsaberHitEffect'
     FireSoundRef="'"
     MeleeHitSoundRefs(0)="'"
     FireSound=SoundGroup'Lightsaber_SN.Weapon_Lightsaber.LSswing'
     FireRate=0.670000
     BotRefireRate=0.850000
}
